package com.doit.demo03;

import java.util.Arrays;
import java.util.function.Function;

//根据长度 创建数组
public class test03_Function {
    public static void main(String[] args) {

        //标准
        method(10,(Integer length)->{
            return new int[length];
        });
        //简写
        method(8,n->new int [n] );
        //引用
        method(5,int[]::new);

    }
    public static void method(Integer length, Function<Integer,int[]>f){
        int[] apply = f.apply(length);
        System.out.println(Arrays.toString(apply));
    }
}
